﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserControlCadContas.ascx.cs" Inherits="TrabalhoWeb.UserControlCadContas" %>
<style type="text/css">
    .cad 
    {
        float:left;
        background-color:lightgrey;
    }
    .lista2
    {
        float:right;
        height: 218px;
    }
    
</style>
<h2>Cadastro de Contas</h2>
<div class="cad">
    <table>
        <tr>
            <td>       
                <asp:Label runat="server" Text="Id:"/>
            </td>
            <td>
                <asp:Label runat="server" ID ="lblId" Text="0"></asp:Label>                
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text="Nome:"/>               
            </td>
            <td>
                <asp:TextBox ID="txtNome" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="txtNome" 
                ErrorMessage="O campo nome é obrigatório!" ValidationGroup="Cadastro">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text="Descrição:"/>
            </td>
            <td>
                <textarea id="txaDescricao" runat ="server"></textarea>        
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text="Categoria:"/>
            <td>
                <asp:DropDownList id="ddlCategoria" runat ="server"
                    DataTextField ="NOME" DataValueField="ID"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text="Data do vencimento:"/>
            <td>
                <asp:Calendar id="cldDtVencimento" runat ="server"  />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text="Valor:"/>
            <td>                
                <asp:TextBox id="txtValor" runat ="server"></asp:TextBox>        
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="txtValor" 
                ErrorMessage="O campo valor é obrigatório!" ValidationGroup="Cadastro">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text="Foto"/>
            <td>
                <asp:FileUpload ID="fluFoto" runat="server" />
            </td>
            <td>
                <asp:Image ID="imgFoto" runat="server"/>
            </td>
        <tr>
            <td>
                <asp:Label runat="server" Text="Pago" />
            <td>
                <asp:CheckBox ID="chkPago" runat="server" />
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" 
                ValidationGroup="Cadastro" />
            </td>
            <td>
                <asp:Button ID="btnSalvar" runat="server" Text ="Salvar" OnClick="btnSalvar_Click" ValidationGroup="Cadastro" />                
            </td>
        </tr>
        </table>
</div>
<div class ="lista2">
    <h3 stContas</h3>
 
    <asp:GridView ID="grvContas" runat="server" 
        AutoGenerateColumns="False" OnRowCommand="grvContas_RowCommand" OnRowDataBound="grvContas_RowDataBound">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="NOME" HeaderText="NOME" SortExpression="NOME" />
            <asp:BoundField DataField="DESCRICAO" HeaderText="DESCRIÇÃO" SortExpression="DESCRICAO" />
            <%--<asp:BoundField DataField="CATEGORIA" HeaderText="CATEGORIA" SortExpression="CATEGORIA" />
            <asp:BoundField DataField="VENCIMENTO" HeaderText="VENCIMENTO" SortExpression="VENCIMENTO" />
            <asp:BoundField DataField="VALOR" HeaderText="VALOR" SortExpression="VALOR" />
            <asp:BoundField DataField="DATA_CADASTRO" HeaderText="DATA DO CADASTRO" SortExpression="DATA_CADASTRO" />
            <asp:ImageField DataImageUrlField="FOTO" HeaderText="FOTO" SortExpression="FOTO" />                            
            <asp:CheckBoxField DataField="STATUS" HeaderText="STATUS" SortExpression="STATUS" />--%>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="imbDeletar"
                    runat = "server"
                    imageUrl = "~/IMG/iconeExcluir.gif" 
                    CommandName = "excluir"
                    OnClientClick = "return confirm('Deseja excluir o categoria?');"
                    CommandArgument='<%#Eval("ID") %>'                    
                    />
                    <asp:ImageButton ID="imbEditar"
                    runat = "server"
                    imageUrl = "~/IMG/editar.gif" 
                    CommandName = "editar"
                    CommandArgument='<%#Eval("ID") %>'                    
                    />
                </ItemTemplate>
            </asp:TemplateField>        
        </Columns>
    </asp:GridView>    
</div>
